<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
  <title>Description of gpcovar</title>
  <meta name="keywords" content="gpcovar">
  <meta name="description" content="GPCOVAR Calculate the covariance for a Gaussian Process.">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="generator" content="m2html &copy; 2003 Guillaume Flandin">
  <meta name="robots" content="index, follow">
  <link type="text/css" rel="stylesheet" href="../../m2html.css">
</head>
<body>
<a name="_top"></a>
<div><a href="../../menu.html">Home</a> &gt;  <a href="#">ReBEL-0.2.7</a> &gt; <a href="#">netlab</a> &gt; gpcovar.m</div>

<!--<table width="100%"><tr><td align="left"><a href="../../menu.html"><img alt="<" border="0" src="../../left.png">&nbsp;Master index</a></td>
<td align="right"><a href="menu.html">Index for .\ReBEL-0.2.7\netlab&nbsp;<img alt=">" border="0" src="../../right.png"></a></td></tr></table>-->

<h1>gpcovar
</h1>

<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="box"><strong>GPCOVAR Calculate the covariance for a Gaussian Process.</strong></div>

<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="box"><strong>function [cov, covf] = gpcovar(net, x) </strong></div>

<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="fragment"><pre class="comment">GPCOVAR Calculate the covariance for a Gaussian Process.

    Description

    COV = GPCOVAR(NET, X) takes  a Gaussian Process data structure NET
    together with a matrix X of input vectors, and computes the
    covariance matrix COV.  The inverse of this matrix is used when
    calculating the mean and variance of the predictions made by NET.

    [COV, COVF] = GPCOVAR(NET, X) also generates the covariance matrix
    due to the covariance function specified by NET.COVARFN as calculated
    by GPCOVARF.

    See also
    <a href="gp.html" class="code" title="function net = gp(nin, covar_fn, prior)">GP</a>, <a href="gppak.html" class="code" title="function hp = gppak(net)">GPPAK</a>, <a href="gpunpak.html" class="code" title="function net = gpunpak(net, hp)">GPUNPAK</a>, <a href="gpcovarp.html" class="code" title="function [covp, covf] = gpcovarp(net, x1, x2)">GPCOVARP</a>, <a href="gpcovarf.html" class="code" title="function covf = gpcovarf(net, x1, x2)">GPCOVARF</a>, <a href="gpfwd.html" class="code" title="function [y, sigsq] = gpfwd(net, x, cninv)">GPFWD</a>, <a href="gperr.html" class="code" title="function [e, edata, eprior] = gperr(net, x, t)">GPERR</a>, <a href="gpgrad.html" class="code" title="function g = gpgrad(net, x, t)">GPGRAD</a></pre></div>

<!-- crossreference -->
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../../matlabicon.gif)">
<li><a href="consist.html" class="code" title="function errstring = consist(model, type, inputs, outputs)">consist</a>	CONSIST Check that arguments are consistent.</li><li><a href="gpcovarp.html" class="code" title="function [covp, covf] = gpcovarp(net, x1, x2)">gpcovarp</a>	GPCOVARP Calculate the prior covariance for a Gaussian Process.</li></ul>
This function is called by:
<ul style="list-style-image:url(../../matlabicon.gif)">
<li><a href="demgp.html" class="code" title="">demgp</a>	DEMGP	Demonstrate simple regression using a Gaussian Process.</li><li><a href="demgpard.html" class="code" title="">demgpard</a>	DEMGPARD Demonstrate ARD using a Gaussian Process.</li><li><a href="demprgp.html" class="code" title="function demprgp(action);">demprgp</a>	DEMPRGP Demonstrate sampling from a Gaussian Process prior.</li><li><a href="gperr.html" class="code" title="function [e, edata, eprior] = gperr(net, x, t)">gperr</a>	GPERR	Evaluate error function for Gaussian Process.</li><li><a href="gpfwd.html" class="code" title="function [y, sigsq] = gpfwd(net, x, cninv)">gpfwd</a>	GPFWD	Forward propagation through Gaussian Process.</li><li><a href="gpgrad.html" class="code" title="function g = gpgrad(net, x, t)">gpgrad</a>	GPGRAD	Evaluate error gradient for Gaussian Process.</li></ul>
<!-- crossreference -->


<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function [cov, covf] = gpcovar(net, x)</a>
0002 <span class="comment">%GPCOVAR Calculate the covariance for a Gaussian Process.</span>
0003 <span class="comment">%</span>
0004 <span class="comment">%    Description</span>
0005 <span class="comment">%</span>
0006 <span class="comment">%    COV = GPCOVAR(NET, X) takes  a Gaussian Process data structure NET</span>
0007 <span class="comment">%    together with a matrix X of input vectors, and computes the</span>
0008 <span class="comment">%    covariance matrix COV.  The inverse of this matrix is used when</span>
0009 <span class="comment">%    calculating the mean and variance of the predictions made by NET.</span>
0010 <span class="comment">%</span>
0011 <span class="comment">%    [COV, COVF] = GPCOVAR(NET, X) also generates the covariance matrix</span>
0012 <span class="comment">%    due to the covariance function specified by NET.COVARFN as calculated</span>
0013 <span class="comment">%    by GPCOVARF.</span>
0014 <span class="comment">%</span>
0015 <span class="comment">%    See also</span>
0016 <span class="comment">%    GP, GPPAK, GPUNPAK, GPCOVARP, GPCOVARF, GPFWD, GPERR, GPGRAD</span>
0017 <span class="comment">%</span>
0018 
0019 <span class="comment">%    Copyright (c) Ian T Nabney (1996-2001)</span>
0020 
0021 <span class="comment">% Check arguments for consistency</span>
0022 errstring = <a href="consist.html" class="code" title="function errstring = consist(model, type, inputs, outputs)">consist</a>(net, <span class="string">'gp'</span>, x);
0023 <span class="keyword">if</span> ~isempty(errstring);
0024   error(errstring);
0025 <span class="keyword">end</span>
0026 
0027 ndata = size(x, 1);
0028 
0029 <span class="comment">% Compute prior covariance</span>
0030 <span class="keyword">if</span> nargout &gt;= 2
0031   [covp, covf] = <a href="gpcovarp.html" class="code" title="function [covp, covf] = gpcovarp(net, x1, x2)">gpcovarp</a>(net, x, x);
0032 <span class="keyword">else</span>
0033   covp = <a href="gpcovarp.html" class="code" title="function [covp, covf] = gpcovarp(net, x1, x2)">gpcovarp</a>(net, x, x);
0034 <span class="keyword">end</span>
0035 
0036 <span class="comment">% Add output noise variance</span>
0037 cov = covp + (net.min_noise + exp(net.noise))*eye(ndata);
0038</pre></div>
<hr><address>Generated on Tue 26-Sep-2006 10:36:21 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/">m2html</a></strong> &copy; 2003</address>
</body>
</html>